package com.example.big_event.service.serviceImpl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.big_event.mapper.ArticleMapper;
import com.example.big_event.pojo.entity.Article;
import com.example.big_event.service.ArticleService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> implements ArticleService {

    @Autowired
    private ArticleMapper articleMapper;


    /**
     * 分页查询
     * @param pageNum 从第几页开始插
     * @param pageSize 每页有几条数据
     * @return 分页之后的对象
     */
    @Override
    public PageInfo<Article> pageQuery(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        // 表示不添加任何条件
        List<Article> list = articleMapper.selectList(null);
        return new PageInfo<>(list);
    }
}
